﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BlockeyEssentials.Drawing
{
    public abstract class Sprite
    {
        public Sprite(Texture2D oTexture)
        {
            Texture = oTexture;
            Layer = 0;
            Source = null;
            Origin = Vector2.Zero;
            Rotation = 0.0f;
            Effect = SpriteEffects.None;
            Color = Color.White;
        }

        #region Methods

        public abstract void Draw(SpriteBatch oSB, float oTransition);

        #endregion

        #region Properties

        public Texture2D Texture
        {
            get { return _Texture; }
            set { _Texture = value; }
        }

        public Rectangle? Source
        {
            get { return _Source; }
            set { _Source = value; }
        }

        public Color Color
        {
            get { return _Color; }
            set { _Color = value; }
        }

        public Vector2 Origin
        {
            get { return _Origin; }
            set { _Origin = value; }
        }

        public float Rotation
        {
            get { return _Rotation; }
            set { _Rotation = value; }
        }

        public SpriteEffects Effect
        {
            get { return _Effect; }
            set { _Effect = value; }
        }

        public int Layer
        {
            get { return _Layer; }
            set
            {
                if (value > 100)
                    value = 100;
                if (value < 0)
                    value = 0;
                _Layer = value;
                _LayerOrder = ((float)_Layer) / 100f;
            }
        }

        protected float LayerOrder
        {
            get { return _LayerOrder; }
        }

        #endregion

        private Texture2D _Texture;
        private Rectangle? _Source;
        private Color _Color;
        private Vector2 _Origin;
        private float _Rotation;
        private SpriteEffects _Effect;
        private int _Layer;
        private float _LayerOrder;

    }
}
